Part Feature/ru

Вступление

A Part Feature object, or formally a Part::Feature, is a simple element with a topological shape that can be displayed in the 3D view.

The Part Feature is the parent class of most 2D (Draft, Sketcher) and 3D (Part, PartDesign) objects, with the exception of meshes, which are normally based on the Mesh Feature, or the FEM FemMeshObject for FEM objects.

Simplified diagram of the relationships between the core objects in FreeCAD

Применение

The Part Feature is an internal object, so it cannot be created from the graphical interface, only from the Python console as described in the Scripting section.

The Part::Feature is defined in the Part Workbench but can be used as the base class for scripted objects in all workbenches that produce 2D and 3D geometrical shapes. Essentially all objects produced in the Part Workbench are instances of a Part::Feature.

Part::Feature is also the parent class of the PartDesign Body, of the PartDesign Features, and of the Part Part2DObject, which is specialized for 2D (planar) shapes.

Workbenches can add more properties to this basic element to produce an object with complex behavior.

Свойства

See Property for all property types that scripted objects can have.

The Part Feature (Part::Feature class) is derived from the basic App GeoFeature (App::GeoFeature class) and inherits all its properties. It also has several additional properties. Notably a ДанныеShape property, which stores the Part TopoShape of the object. This is the geometry that is shown in the 3D view. Other properties that this object has are those related to the appearance of its TopoShape.

These are the properties available in the property editor. Hidden properties can be shown by using the Show all command in the context menu of the property editor.

Данные

Base

Вид

Most objects in FreeCAD have what is called a "viewprovider", which is a class that defines the visual appearance of the object in the 3D view, and in the Tree view. The default viewprovider of Part Feature objects defines the following properties. Scripted objects that are derived from Part Feature will have access to these properties as well.

Base

Display Options

Object style

Selection

Angular deflection and deviation

Angular Deflection and deviation parameters; d < linear deflection, α < angular deflection.

The deviation is a value in percentage that is related to the dimensions in millimeters of the bounding box of the object. The deviation in millimeters can be calculated as follows:

deviation_in_mm = (w + h + d)/3 * deviation/100

where w, h, d are the bounding box dimensions.

Scripting

See also: FreeCAD Scripting Basics and scripted objects.

A Part Feature is created with the addObject() method of the document.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Feature", "Name")
obj.Label = "Custom label"

For Python subclassing, you should create a Part::FeaturePython object.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::FeaturePython", "Name")
obj.Label = "Custom label"

Name

See also: Object name for more information on the properties of the Name.

The addObject method has two basic string arguments.

Label

If desired, the Label attribute can be changed to a more meaningful text.